//#############################################################################
//#############################################################################
//This source file was written by Mert Dogar. If you have some questions about 
//the source code, please do not hesitate to ask me.
//The code is under GPL.
//Email: mertdogar@gmail.com , http://code.google.com/p/electron-cds
//#############################################################################
//#############################################################################

#include "main.h"
#include "tvector.h"
#include "component_base.h"

class sheet
{
	public:
	
	sheet() {factor = 1; sroot = tovector2 (0,0); changed=false; };
	~sheet() {};
	bool changed;
	cbase &get_component(int index);
	void add_component(std::string strname, vector2 pos);
	void slect_by_index(int index);
	void tadd_component(Cairo::RefPtr<Cairo::Context> cr,std::string strname, vector2 pos);
	void make_null_selected(Cairo::RefPtr<Cairo::Context> cr, int index);
	int size () { return components.size(); }
	void print_components(Cairo::RefPtr<Cairo::Context> cr);	
	int isonwho(Cairo::RefPtr<Cairo::Context> cr, vector2 pos);	
	float getfactor() { return factor; };
	void setfactor(float rhs) { factor = rhs; };
	void setroot(vector2 vec);
	void dell(Cairo::RefPtr<Cairo::Context> cr);
	void add_wire(vector2 start, vector2 end, float line_width);
	private:
	tvector<cbase> components;	
	float factor;
	vector2 sroot;
	std::string find_new_name(std::string prefix);
	void clear_screen(Cairo::RefPtr<Cairo::Context> cr);
};
